import { Injectable } from '@nestjs/common';
import * as jwt from 'jsonwebtoken';


@Injectable()
export class JwtService {
  async sign(user: { id: number, openID: string }): Promise<string> {
    return jwt.sign(user, process.env.JWT_SECRET_KEY || '', { expiresIn: process.env.JWT_EXPIRATION_TIME });
  }

  async verify(token: string): Promise<any> {
    return jwt.verify(token, process.env.JWT_SECRET_KEY || '');
  }
}

